package RuiGe;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int p1 = s.nextInt();
        int p2 = s.nextInt();
        int p3 = s.nextInt();
        String str1 = s.next();
        String[] split = str1.split("-");
        if (p1 == 1) {
            for (int i = 0; i < split.length - 1; i++) {
                //判断最后一个，和第一个行不行
                String strTmp1 = split[i];
                String strTmp2 = split[i + 1];

                if (!(strTmp1.charAt(strTmp1.length() - 1) >= '0' && strTmp2.charAt(0) <= '9') &&
                        !(strTmp1.charAt(strTmp1.length() - 1) >= 'a' && strTmp2.charAt(0) <= 'z')) {
                    strTmp1 = strTmp1 + "-";
                }else {
                    if (strTmp1.charAt(strTmp1.length() - 1) >= strTmp2.charAt(0)) {
                        //如果左边大于右边，就加个-就行了
                        split[i] = split[i] + "-";
                        continue;
                    }
                    //开始判断p3
                    if (p3 == 1) {
                        //这里要顺序加,找到最后一个元素
                        char start = strTmp1.charAt(strTmp1.length() - 1);
                        char end = strTmp2.charAt(0);
                        //开始加
                        StringBuilder sbTmp=new StringBuilder();
                        sbTmp.append(strTmp1);
                        for (int l = start + 1; l < end; l++) {
                            char tmp = (char) l;
                            for (int k = 0; k < p2; k++) {
                                sbTmp.append(tmp);
                            }
                        }
                        strTmp1=sbTmp.toString();
                    }
                    //逆序加
                    else if (p3 == 2) {
                        StringBuilder sbTmp=new StringBuilder();
                        sbTmp.append(strTmp1);
                        char start = strTmp1.charAt(strTmp1.length() - 1);
                        char end = strTmp2.charAt(0);
                        //开始加
                        for (int l = end - 1; l > start; l--) {
                            char tmp = (char) l;
                            for (int k = 0; k < p2; k++) {
                                sbTmp.append(tmp);
                            }
                        }
                        strTmp1=sbTmp.toString();
                    }
                }
                split[i] = strTmp1;
            }
        } else if (p1 == 2) {
            for (int i = 0; i < split.length - 1; i++) {
                //判断最后一个，和第一个行不行
                String strTmp1 = split[i];
                String strTmp2 = split[i + 1];
                if (  !(strTmp1.charAt(strTmp1.length() - 1) >= '0' && strTmp2.charAt(0) <= '9') &&
                       ! (strTmp1.charAt(strTmp1.length() - 1) >= 'a' && strTmp2.charAt(0) <= 'z')) {
                    strTmp1 =strTmp1 + "-";
                } else {
                    if (strTmp1.charAt(strTmp1.length() - 1) >= strTmp2.charAt(0)) {
                        //如果左边大于右边，就加个-就行了
                        split[i] = split[i] + "-";
                        continue;
                    }
                    //开始判断p3
                    if (p3 == 1) {
                        //这里要顺序加,找到最后一个元素
                        char start = strTmp1.charAt(strTmp1.length() - 1);
                        char end = strTmp2.charAt(0);
                        //开始加
                        StringBuilder sbTmp=new StringBuilder();
                        sbTmp.append(strTmp1);
                        for (int l = start + 1; l < end; l++) {
                            char tmp = (char) l;
                            if (tmp >= 'a' && tmp <= 'z') {
                                tmp -= 32;
                            }
                            for (int k = 0; k < p2; k++) {
                                sbTmp.append(tmp);
                            }
                        }
                        strTmp1=sbTmp.toString();
                    }
                    //逆序加
                    else if (p3 == 2) {
                        char start = strTmp1.charAt(strTmp1.length() - 1);
                        char end = strTmp2.charAt(0);
                        //开始加
                        StringBuilder sbTmp=new StringBuilder();
                        sbTmp.append(strTmp1);
                        for (int l = end - 1; l > start; l--) {
                            char tmp = (char) l;
                            if (tmp >= 'a' && tmp <= 'z') {
                                tmp -= 32;
                            }
                            for (int k = 0; k < p2; k++) {
                                sbTmp.append(tmp);
                            }
                        }
                        strTmp1=sbTmp.toString();
                    }
                }

                split[i] = strTmp1;
            }
        } else if (p1 == 3) {
            for (int i = 0; i < split.length - 1; i++) {
                //判断最后一个，和第一个行不行
                String strTmp1 = split[i];
                String strTmp2 = split[i + 1];
                if (!(strTmp1.charAt(strTmp1.length() - 1) >= '0' && strTmp2.charAt(0) <= '9') &&
                        !(strTmp1.charAt(strTmp1.length() - 1) >= 'a' && strTmp2.charAt(0) <= 'z')) {
                    strTmp1 = strTmp1 + "-";
                } else {
                    if (strTmp1.charAt(strTmp1.length() - 1) >= strTmp2.charAt(0)) {
                        //如果左边大于右边，就加个-就行了
                        split[i] = split[i] + "-";
                        continue;
                    }
                    //开始判断p3
                    //这里要顺序加,找到最后一个元素
                    char start = strTmp1.charAt(strTmp1.length() - 1);
                    char end = strTmp2.charAt(0);
                    //开始加
                    StringBuilder sbTmp=new StringBuilder();
                    sbTmp.append(strTmp1);
                    for (int l = start + 1; l < end; l++) {
                        for (int k = 0; k < p2; k++) {
                            sbTmp.append("*");
                        }
                    }
                    //逆序加
                    strTmp1=sbTmp.toString();
                }
                split[i] = strTmp1;
            }
        }
        StringBuilder sb1 = new StringBuilder();
        for (int i = 0; i < split.length; i++) {
            sb1.append(split[i]);
        }
        String str3 = sb1.toString();
        System.out.println(str3);
    }
}
